home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #4 / Amiga Plus CD - 2000 - No. 4.iso / Tools / Commo-Support / Disk-Archive / includes-1_4.dms / includes-1_4.adf / i.zoo / dos / rdargs.i < prev    next >
Encoding:
Text File  |  1989-12-17  |  4.3 KB  |  121 lines

  1.     IFND    DOS_RDARGS_I
  2. DOS_RDARGS_I SET 1
  3.  
  4. **********************************************************************
  5. * rdargs.i
  6. *
  7. *    Copyright (c) 1989, Commodore-Amiga Inc.
  8. *    All Rights Reserved 
  9. *
  10. * This include file defines data types used in the V1.4 dos.library.
  11. * Preliminary specs subject to change.
  12. **********************************************************************
  13.  
  14.     IFND EXEC_NODES_I
  15.     INCLUDE "exec/nodes.i"
  16.     ENDC
  17.  
  18. **********************************************************************
  19. *
  20. * The CSource data structure defines the input source for "RdItem()"
  21. * as well as the ReadArgs call.  It is a publicly defined structure
  22. * which may be used by applications which use code that follows the
  23. * conventions defined for access.
  24. *
  25. * When passed to the dos.library functions, the value passed as
  26. * struct *CSource is defined as follows:
  27. *    if ( CSource == 0)    Use buffered IO "ReadChar()" as data source
  28. *    else            Use CSource for input character stream
  29. *
  30. * The following two pseudo-code routines define how the CSource structure
  31. * is used:
  32. *
  33. * long CS_ReadChar( struct CSource *CSource )
  34. * {
  35. *    if ( CSource == 0 )    return ReadChar();
  36. *    if ( CSource->CurChr >= CSource->Length )    return ENDSTREAMCHAR;
  37. *    return CSource->Buffer[ CSource->CurChr++ ];
  38. * }
  39. *
  40. * BOOL CS_UnReadChar( struct CSource *CSource )
  41. * {
  42. *    if ( CSource == 0 )    return UnReadChar();
  43. *    if ( CSource->CurChr <= 0 )    return FALSE;
  44. *    CSource->CurChr--;
  45. *    return TRUE;
  46. * }
  47. *
  48. * To initialize a struct CSource, you set CSource->CS_Buffer to
  49. * a string which is used as the data source, and set CS_Length to
  50. * the number of characters in the string.  Normally CS_CurChr should
  51. * be initialized to ZERO, or left as it was from prior use as
  52. * a CSource.
  53. *
  54. **********************************************************************
  55.  
  56.     STRUCTURE    CSource,0
  57.         APTR    CS_Buffer
  58.         LONG    CS_Length
  59.         LONG    CS_CurChr
  60.         LABEL    CS_SIZEOF
  61.  
  62. **********************************************************************
  63. *
  64. * The RDArgs data structure is the input parameter passed to the DOS
  65. * ReadArgs() function call.
  66. *
  67. * The RDA_Source structure is a CSource as defined above;
  68. * if RDA_Source.CS_Buffer is non-null, RDA_Source is used as the input
  69. * character stream to parse, else the input comes from the buffered STDIN
  70. * calls ReadChar/UnReadChar.
  71. *
  72. * RDA_DAList is a private address which is used internally to track
  73. * allocations which are freed by FreeArgs().  This MUST be initialized
  74. * to NULL prior to the first call to ReadArgs().
  75. *
  76. * The RDA_Buffer and RDA_BufSiz fields allow the application to supply
  77. * a fixed-size buffer in which to store the parsed data.  This allows
  78. * the application to pre-allocate a buffer rather than requiring buffer
  79. * space to be allocated.  If either RDA_Buffer or RDA_BufSiz is NULL,
  80. * the application has not supplied a buffer.
  81. *
  82. * The RDA_Template pointer is a standard AmigaDOS template string,
  83. * such as "TO,FROM/A,ALL/S".   This is defined elsewhere.
  84. *
  85. * RDA_ExtHelp is a text string which will be displayed instead of the
  86. * template string, if the user is prompted for input.
  87. *
  88. * RDA_Flags bits control how ReadArgs() works.  The flag bits are
  89. * defined below.  Defaults are initialized to ZERO.
  90. *
  91. **********************************************************************
  92.  
  93.     STRUCTURE    RDArgs,0
  94.         STRUCT    RDA_Source,CS_SIZEOF    ; Select input source
  95.         APTR    RDA_DAList        ; PRIVATE.
  96.         LONG    RDA_Buffer        ; Optional string parsing space.
  97.         LONG    RDA_BufSiz        ; Size of RDA_Buffer (0..n)
  98.         APTR    RDA_ExtHelp        ; Optional extended help
  99.         LONG    RDA_Flags        ; Flags for any required control
  100.         LABEL    RDA_SIZEOF
  101.  
  102.     BITDEF    RDA,STDIN,0    ; Use "STDIN" rather than "COMMAND LINE"
  103.     BITDEF    RDA,NOALLOC,1    ; If set, do not allocate extra string space.
  104.     BITDEF    RDA,NOPROMPT,2    ; Disable reprompting for string input.
  105.  
  106. **********************************************************************
  107. * Maximum number of template keywords which can be in a template passed
  108. * to ReadArgs(). IMPLEMENTOR NOTE - must be a multiple of 4.
  109. **********************************************************************
  110. MAX_TEMPLATE_ITEMS    equ    100
  111.  
  112. **********************************************************************
  113. * Maximum number of MULTIARG items returned by ReadArgs(), before
  114. * an ERROR_LINE_TOO_LONG.  These two limitations are due to stack
  115. * usage.  Applications should allow "a lot" of stack to use ReadArgs().
  116. **********************************************************************
  117. MAX_MULTIARGS    equ    128
  118.  
  119.     ENDC    ; DOS_RDARGS_I
  120.